<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改npc')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-fantasyNpc-edit" th:object="${fantasyNpc}" enctype="multipart/form-data">
            <input id="npcId" name="npcId" th:field="*{npcId}"  type="hidden">
			<div class="form-group">	
				<label class="col-sm-3 control-label">npc姓名：</label>
				<div class="col-sm-8">
					<input id="npcName" name="npcName" th:field="*{npcName}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">npc详情：</label>
				<div class="col-sm-8">
					<textarea id="npcDesc" name="npcDesc" th:field="*{npcDesc}" class="form-control" type="text"></textarea>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">npc头像url：</label>
				<div class="col-sm-8">
					<input id="npc" name="npc" class="form-control" type="file" accept="image/*">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">npc类型：</label>
				<div class="col-sm-8">
					<select id="npcType" name="npcType" class="form-control">
						<option value="0" th:selected="*{npcType == 0}">所有</option>
						<option value="1" th:selected="*{npcType == 1}">拜贤</option>
						<option value="2" th:selected="*{npcType == 2}">寻物</option>
						<option value="3" th:selected="*{npcType == 3}">送物</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">npc通用话语：</label>
				<div class="col-sm-8">
					<select id="npcCommonTalkStatus" name="npcCommonTalkStatus" class="form-control">
						<option value="0" th:selected="*{npcCommonTalkStatus == 0}">否</option>
						<option value="1" th:selected="*{npcCommonTalkStatus == 1}">是</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">npc专有话语：</label>
				<div class="col-sm-8">
					<select id="npcSpecialTalkStatus" name="npcSpecialTalkStatus" class="form-control">
						<option value="0" th:selected="*{npcSpecialTalkStatus == 0}">否</option>
						<option value="1" th:selected="*{npcSpecialTalkStatus == 1}">是</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">npc问题答复：</label>
				<div class="col-sm-8">
					<select id="npcReplyStatus" name="npcReplyStatus" class="form-control">
						<option value="0" th:selected="*{npcReplyStatus == 0}">否</option>
						<option value="1" th:selected="*{npcReplyStatus == 1}">是</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">通用任务发放：</label>
				<div class="col-sm-8">
					<select id="npcCommonTaskStatus" name="npcCommonTaskStatus" class="form-control">
						<option value="0" th:selected="*{npcCommonTaskStatus == 0}">否</option>
						<option value="1" th:selected="*{npcCommonTaskStatus == 1}">是</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">专有任务发放：</label>
				<div class="col-sm-8">
					<select id="npcSpecialTaskStatus" name="npcSpecialTaskStatus" class="form-control">
						<option value="0" th:selected="*{npcSpecialTaskStatus == 0}">否</option>
						<option value="1" th:selected="*{npcSpecialTaskStatus == 1}">是</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注信息：</label>
				<div class="col-sm-8">
					<textarea id="remark" name="remark" th:field="*{remark}" class="form-control"></textarea>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "fantasy/fantasyNpc";
		$("#form-fantasyNpc-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
			},
			focusCleanup: true
		});
		
		function submitHandler() {
            if ($.validate.form()) {
                var url = prefix + "/edit";
                $.modal.loading("正在处理中，请稍后...");
                var formdata = new FormData($('#form-fantasyNpc-edit')[0]);
                var config = {
                    url: url,
                    type: "post",
                    dataType: "json",
                    data: formdata,
                    processData: false,
                    contentType: false,
                    success: function(result) {
                        $.operate.successCallback(result);
                    }
                };
                $.ajax(config)
            }
	    }
	</script>
</body>
</html>
